<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>年级列表</title>
    <script src="./vue3.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="item in grades">
                {{item.gradeID}} -- {{item.gradeName}}
            </li>
        </ul>
    </div>
    <script>
        const {createApp} = Vue
        createApp({
            data(){
                return {
                    grades: []
                }
            },
            methods:{
                loadgrades(){
                    axios.get('http://localhost:8080/grade/all').then(res => {
                        console.log(res.data)
                        this.grades = res.data.data
                    })
                }
            },
            created(){
                this.loadgrades()
            }
        }).mount('#app')
    </script>
</body>
</html>